/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package model.impl;

import model.Actor;
import model.AssociationActorSerie;
import model.ModelPackage;
import model.Role;
import model.Serie;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Association Actor Serie</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link model.impl.AssociationActorSerieImpl#getTarget <em>Target</em>}</li>
 *   <li>{@link model.impl.AssociationActorSerieImpl#getSource <em>Source</em>}</li>
 *   <li>{@link model.impl.AssociationActorSerieImpl#getRoleActorSerie <em>Role Actor Serie</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AssociationActorSerieImpl extends AssociationImpl implements AssociationActorSerie {
	/**
	 * The cached value of the '{@link #getTarget() <em>Target</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTarget()
	 * @generated
	 * @ordered
	 */
	protected Actor target;

	/**
	 * The cached value of the '{@link #getSource() <em>Source</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSource()
	 * @generated
	 * @ordered
	 */
	protected Serie source;

	/**
	 * The cached value of the '{@link #getRoleActorSerie() <em>Role Actor Serie</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRoleActorSerie()
	 * @generated
	 * @ordered
	 */
	protected Role roleActorSerie;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AssociationActorSerieImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.ASSOCIATION_ACTOR_SERIE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Actor getTarget() {
		if (target != null && target.eIsProxy()) {
			InternalEObject oldTarget = (InternalEObject)target;
			target = (Actor)eResolveProxy(oldTarget);
			if (target != oldTarget) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET, oldTarget, target));
			}
		}
		return target;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Actor basicGetTarget() {
		return target;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetTarget(Actor newTarget, NotificationChain msgs) {
		Actor oldTarget = target;
		target = newTarget;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET, oldTarget, newTarget);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTarget(Actor newTarget) {
		if (newTarget != target) {
			NotificationChain msgs = null;
			if (target != null)
				msgs = ((InternalEObject)target).eInverseRemove(this, ModelPackage.ACTOR__ACTOR_SERIE, Actor.class, msgs);
			if (newTarget != null)
				msgs = ((InternalEObject)newTarget).eInverseAdd(this, ModelPackage.ACTOR__ACTOR_SERIE, Actor.class, msgs);
			msgs = basicSetTarget(newTarget, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET, newTarget, newTarget));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Serie getSource() {
		if (source != null && source.eIsProxy()) {
			InternalEObject oldSource = (InternalEObject)source;
			source = (Serie)eResolveProxy(oldSource);
			if (source != oldSource) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.ASSOCIATION_ACTOR_SERIE__SOURCE, oldSource, source));
			}
		}
		return source;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Serie basicGetSource() {
		return source;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSource(Serie newSource) {
		Serie oldSource = source;
		source = newSource;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ASSOCIATION_ACTOR_SERIE__SOURCE, oldSource, source));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Role getRoleActorSerie() {
		if (roleActorSerie != null && roleActorSerie.eIsProxy()) {
			InternalEObject oldRoleActorSerie = (InternalEObject)roleActorSerie;
			roleActorSerie = (Role)eResolveProxy(oldRoleActorSerie);
			if (roleActorSerie != oldRoleActorSerie) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.ASSOCIATION_ACTOR_SERIE__ROLE_ACTOR_SERIE, oldRoleActorSerie, roleActorSerie));
			}
		}
		return roleActorSerie;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Role basicGetRoleActorSerie() {
		return roleActorSerie;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRoleActorSerie(Role newRoleActorSerie) {
		Role oldRoleActorSerie = roleActorSerie;
		roleActorSerie = newRoleActorSerie;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ASSOCIATION_ACTOR_SERIE__ROLE_ACTOR_SERIE, oldRoleActorSerie, roleActorSerie));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET:
				if (target != null)
					msgs = ((InternalEObject)target).eInverseRemove(this, ModelPackage.ACTOR__ACTOR_SERIE, Actor.class, msgs);
				return basicSetTarget((Actor)otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET:
				return basicSetTarget(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET:
				if (resolve) return getTarget();
				return basicGetTarget();
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__SOURCE:
				if (resolve) return getSource();
				return basicGetSource();
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__ROLE_ACTOR_SERIE:
				if (resolve) return getRoleActorSerie();
				return basicGetRoleActorSerie();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET:
				setTarget((Actor)newValue);
				return;
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__SOURCE:
				setSource((Serie)newValue);
				return;
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__ROLE_ACTOR_SERIE:
				setRoleActorSerie((Role)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET:
				setTarget((Actor)null);
				return;
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__SOURCE:
				setSource((Serie)null);
				return;
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__ROLE_ACTOR_SERIE:
				setRoleActorSerie((Role)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET:
				return target != null;
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__SOURCE:
				return source != null;
			case ModelPackage.ASSOCIATION_ACTOR_SERIE__ROLE_ACTOR_SERIE:
				return roleActorSerie != null;
		}
		return super.eIsSet(featureID);
	}

} //AssociationActorSerieImpl
